< previous page page_71 next page >

Page 71
0071-01.jpg
Figure 2.7
Example program Rect demonstrates
the RoundRect API function.
e10a6a0a59f035e870d90cca05b85fce.gif
    ByVal X1 As Long, ByVal Y1 As Long, _ 
    ByVal X2 As Long, ByVal Y2 As Long) as Long 

Private Declare Function Arc Lib "gdi32" _ 
    Alias "Arc" (ByVal hdc As Long, _ 
    ByVal X1 As Long, ByVal Y1 As Long, _ 
    ByVal X2 As Long, ByVal Y2 As Long, _ 
    ByVal X3 As Long, ByVal Y3 As Long, _ 
    ByVal X4 As Long, ByVal Y4 As Long) As Long 

Private Declare Function Chord Lib "gdi32" _ 
    Alias "Chord" (ByVal hdc As Long, _ 
    ByVal X1 As Long, ByVal Y1 As Long, _ 
    ByVal X2 As Long, ByVal Y2 As Long, _ 
    ByVal X3 As Long, ByVal Y3 As Long, _ 
    ByVal X4 As Long, ByVal Y4 As Long) As Long 

Private Declare Function Pie Lib "gdi32" _ 
    Alias "Pie" (ByVal hdc As Long, _ 
    ByVal X1 As Long, ByVal Y1 As Long, _ 
    ByVal X2 As Long, ByVal Y2 As Long, _ 
    ByVal X3 As Long, ByVal Y3 As Long, _ 
    ByVal X4 As Long, ByVal Y4 As Long) As Long
The Ellipse function draws an ellipse bounded by a rectangle with oposite corners at (X1, Y1) and (X2, Y2). This is much easier to understand than Visual Basic's Circle function with its aspect parameter. Figure 2.8 shows how these coordinates determine the shape of the ellipse.
The Arc function draws an arc of an ellipse. The ellipse is bounded by the rectangle with corners (X1, Y1) and (X2, Y2) as in the Ellipse function. The arc begins where the line connecting the center of the ellipse and the point (X3, Y3) intersects the ellipse. The arc ends where the line connecting the center of the ellipse and the point (X4, Y4) intersects the ellipse. Figure 2.9 shows how these parameters define the arc. Note that the points (X3, Y3) and (X4, Y4) do not need to lie on or within the ellipse.

 
< previous page page_71 next page >